<template>
  <div >
      <!-- 二级路由出口 -->
      <keep-alive>
            <router-view class="view"></router-view> 
      </keep-alive>
    
      <footer class="footer2">
            <router-link v-for="item in navs" :key="item.id" :to="item.path" active-class="select">
            <img :src="$route.path === item.path ? item.select_img : item.no_selevt">
            <div>{{item.name}}</div>
            </router-link>
      </footer>
  </div>
</template>

<script>
import home_y from "../../assets/img/home_y.jpeg"
import home_n from "../../assets/img/home_n.jpeg"
import cate_y from "../../assets/img/cate_y.jpeg"
import cate_n from "../../assets/img/cate_n.jpeg"
import shop_y from "../../assets/img/shop_y.jpeg"
import shop_n from "../../assets/img/shop_n.jpeg"
import mine_y from "../../assets/img/mine_y.jpeg"
import mine_n from "../../assets/img/mine_n.jpeg"
export default {
  data(){
    return {
      navs: [
         {
          path:"/index/home",
          name:"首页",
          select_img:home_y,
          no_selevt:home_n
        },   {
          path:"/index/cate",
          name:"分类",
          select_img:cate_y,
          no_selevt:cate_n
        },
        {
          path:"/index/shop",
          name:"购物车",
          select_img:shop_y,
          no_selevt:shop_n
        },
        {
          path:"/index/mine",
          name:"我的",
          select_img:mine_y,
          no_selevt:mine_n
        },
      ]
    }
  }
}
</script>

<style>
.footer2{
  height: 1rem;
  position: fixed;
  width: 100vw;
  background: #fff;
  left: 0;
  bottom: 0;
  border-top: 0.01rem solid #ccc;
  display: flex;
}
.footer2 a{
  flex: 1;
  text-align: center;
}
.footer2 a img{
  width: 0.5rem;
  height: 0.5rem;
}
.footer2 a div{
  font-size: 0.24rem;
  line-height: 0.5rem;
  color:#333;
}
.footer2 .select div{
  color: #ff4400;
}

</style>